home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_10
/
saks
/
common.h
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-08
|
741b
|
36 lines
Listing 4 - A abstract base class for objects in generic containers
//
// common.h - a common abstract type for objects placed in containers
//
#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED
#include <iostream.h>
class common
{
public:
virtual const common &
operator=(const common &c) = 0;
virtual common *dup() const = 0;
virtual size_t size() const = 0;
virtual ostream &write(ostream &s) const = 0;
virtual istream &read(istream &s) = 0;
virtual ~common() { }
};
inline ostream &operator<<(ostream &os, const common &c)
{
return c.write(os);
}
inline istream &operator>>(istream &os, common &c)
{
return c.read(os);
}
#endif